home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_01
/
1001128b
< prev
next >
Wrap
Text File
|
1991-11-17
|
820b
|
43 lines
#include "region.h"
region::region(int x0,int y0, int x1, int y1,int save)
{
left=x0;
top=y0;
right=x1;
bot=y1;
buf=NULL;
if (save)
reinit();
}
void region::reinit(void)
{
if (buf) delete buf;
buf=new char[2*(1+right-left)*(1+bot-top)];
gettext(left,top,right,bot,buf);
}
void region::restore(void)
{
if (buf)
{
puttext(left,top,right,bot,buf);
destroy();
}
}
region::~region()
{
restore();
}
void region::destroy(void)
{
if (buf)
{
delete buf;
buf=NULL;
}
}